package com.first.teacher.controller;

import com.first.common.pojo.EduSubject;
import com.first.common.vo.Result;
import com.first.teacher.service.SubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: finrsteducation-parent
 * @description:
 * @author: 张玉森
 * @create: 2023-06-07 14:59
 **/
@RestController
@RequestMapping("/core/subject")
@Api(tags = "subject操作")
public class SubjectController {
    @Autowired
    private SubjectService subjectService;
    @ApiOperation("根据父id查询其父亲的父id,,如果为0表示为2级下拉框，，否则就是三级下拉框")
    @GetMapping("findPidByid/{pid}")
    public Result findPidByid(@PathVariable String pid){
        Object id= subjectService.findPidByid(pid);
        return Result.success(id);
    }
    @ApiOperation("获取课程分类信息并填充下拉框")
    @PostMapping("findsubjectByStatus/{page}/{pageSize}")
    public Result findsubjectByStatus(@PathVariable Integer page,@PathVariable Integer pageSize){
        List<EduSubject> subjectPage =subjectService.findsubjectByStatus(page,pageSize);
        return Result.success(subjectPage);
    }
}
